import request from '@/utils/request'

// 初始化分片上传
export function initMultipartUpload(data) {
  return request({
    url: '/file/multipart/init',
    method: 'post',
    data: data,
    headers: { 'repeatSubmit': false }
  })
}


// 批量获取分片预签名上传URL
export function getBatchPresignedUploadUrls(data) {
  return request({
    url: '/file/multipart/batch-presign',
    method: 'post',
    data: data,
    headers: { 'repeatSubmit': false }
  })
}

// 完成分片上传
export function completeMultipartUpload(data) {
  return request({
    url: '/file/multipart/complete',
    method: 'post',
    data: data,
    headers: { 'repeatSubmit': false }
  })
}

// 取消分片上传
export function abortMultipartUpload(filePath, uploadId, configId) {
  return request({
    url: '/file/multipart/abort',
    method: 'delete',
    params: {
      filePath,
      uploadId,
      configId
    }
  })
}
